<template>
  <div>
    <!-- 添加按钮 -->
    <el-button type="primary" @click="showAddPop" >添加</el-button>
    <!-- 表格 -->
    <v-list :info="info" :list="list" @init="getList" @showUpdate="showUpdate"></v-list>
    <!-- 弹出框 -->
    <v-form :info="info" @init="getList" ref="form"></v-form>
  </div>
</template>
<script>
import { mapGetters, mapActions } from "vuex";
import vList from './components/list.vue'
import vForm from './components/form.vue'
import {reqrolelist} from '../../http/api'
import {toggle} from '../../mixins/index'
export default {
  mixins:[toggle],
  components:{vList,vForm},
  data() {
    return {
      info:{
        isShow:false,
        isAdd:true,
      },
      list: [],
    };
  },
  computed: {
    ...mapGetters({}),
  },
  mounted() {
    this.getList();
  },
  methods: {
    ...mapActions({}),
    //获取数据列表
    async getList(){
      console.log('111');
      let {data:res} = await reqrolelist();
      if(res.code == 200) {
        this.list = res.list ? res.list : [];
      }
    },
  },
};
</script>
<style scoped lang="less">
@import "../../less/index.less";
</style>